package com.hc.controller;

import com.hc.bean.UserRoleResultModel;
import com.hc.entity.SysUserInfo;
import com.hc.service.SysUserInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author LiuZhiHao
 * @date 2019/9/5 10:10
 * 描述:
 **/
@RestController
@RequestMapping("/qcUser")
@Api("用户登录")
public class QcUserController {

    @Autowired
    private SysUserInfoService sysUserInfoService;

    @PostMapping("/login")
    @ApiOperation("用户登录")
    public UserRoleResultModel userLogin(@RequestBody UserRoleResultModel userRoleResultModel){
        return sysUserInfoService.userLogin(userRoleResultModel);
    }

    @GetMapping("/getAllUserInfo")
    public List<SysUserInfo> getUserAllInfo(){
        return sysUserInfoService.list();
    }

//    @PostMapping("/login")
//    @ApiOperation("用户登录")
//    public UserRoleResultModel userlogin(@RequestBody UserRoleResultModel userRoleResultModel){
//        Map<String, String> postHeaders = new HashMap<>();
//        postHeaders.put("Content-Type","application/json");
//        String s = HttpUtil.postJson(url, postHeaders, JsonUtil.toJson(userRoleResultModel));
//        if (StringUtils.isEmpty(s)){
//            throw  new TlsRuntimeException("用户名或密码错误");
//        }
//        return JsonUtil.toBean(s, UserRoleResultModel.class);
//    }

}
